<?php
	if(isset($_GET['id']) && isset($_GET['pin']))
	{
		$MaHoaDon = trim($_GET['id']);
		$PIN        = trim($_GET['pin']);
		include_once '../classes/hoadon_bs.php';
		include_once '../classes/nguoidung_bs.php';
		
		$HoaDon = new hoadon_bs();
		$HoaDon->SetMaHoaDon($MaHoaDon);
		$HoaDon->SetPIN($PIN);
		$DHoaDon = $HoaDon->LayDanhSach();
		
		if($DHoaDon == null)
			header('Location: index.php?act=hoadon_danhsach');
		else
		{
?>
	<div class="FormCapNhat">
		
			<div class="Title">
				Thông tin chi tiết hóa đơn
				<div style="float:right">
					<a href="index.php?act=hoadon_capnhat&id=<?php echo $MaHoaDon; ?>&pin=<?php echo $PIN; ?>">Cập nhật</a>
				</div>
			</div>
			<div class="Left">
				<table width="100%">
					<tr>
						<th colspan="2">Thông tin hóa đơn</th>
					</tr>
					<tr>
						<td width="20%">Mã hóa đơn</td>
						<td><input name="MaHocVien" type="text" readonly="true" value="<?php echo $DHoaDon[0]['MaHoaDon']; ?>"/></td>
					</tr>
					<tr>
						<td>Quyển hóa đơn</td>
						<td><input readonly="true" name="HoTen" style="font-weight:bold" type="text" value="<?php echo $DHoaDon[0]['MaQuyenHoaDon']; ?>"/></td>
					</tr>
					<tr>
						<td>Ngày lập</td>
						<td><input readonly="true" type="text" value="<?php echo ConvertDate($DHoaDon[0]['NgayLap']); ?>"/></td>
					</tr>
					<tr>
						<td>Lý do nộp</td>
						<td>
							<input type="text" readonly="true" value="<?php echo 'Học phí ' . $DHoaDon[0]['MaChuongTrinh']; ?>" />
						</td>
					</tr>
				</table>
			</div>
			<div class="Right">
				<table width="100%">
					<tr>
						<th colspan="2">Đối tượng liên quan</th>
					</tr>
					<tr>
						<td width="35%">Người lập</td>
						<td>
							<input type="text" readonly="true" value="<?php echo $DHoaDon[0]['MaNguoiDung']; ?>" />
						</td>
					</tr>
					<tr>
						<td>Người nộp</td>
						<td>
							<input type="text" readonly="true" value="<?php echo $DHoaDon[0]['MaHocVien']; ?>"/>
						</td>
					</tr>
					<tr>
						<td>Số tiền nộp</td>
						<td>
							<input readonly="true" name="SoMay" type="text" value="<?php echo $DHoaDon[0]['ThanhTien']; ?>" />
						</td>
					</tr>
				</table>
			</div>
			
			<div class="Bottom">
				<a href="index.php?act=hoadon_danhsach" class="LinkBackToList">Danh sách hóa đơn</a>
			</div>
		
	</div>
<?php
		}
	}
	else
	{
		header('Location: index.php?act=hoadon_danhsach');
	}